// pages/xinjian/quan/quan.js
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		type: 1,
		sta: 1,
		data:''
	},

	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad: function(options) {
		this.req()
	},
	req() {
		wx.getStorage({
			key: 'uid',
			success: (e) => {
				wx.request({
					url: getApp().globalData.xc,
					method: "POST",
					header: {
						"Content-Type": "application/x-www-form-urlencoded"
					},
					data: {
						HTTP_API: 'vv/amountcard/api/index/myCard',
						token: e.data.uid,
						type: this.data.type
					},
					success: (e) => {
						e.data.data.list.forEach(function(item, index) {
							item.valid_time = new Date(parseInt(item.valid_time) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');
						})
						console.log(e)
						this.setData({
							data: e.data.data.list
						})
					}
				})
			}
		})
	},
	index(e) {
		this.setData({
			list: [],
			sta: e.currentTarget.dataset.id,
		})
		this.req()
	},
})
